Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Conversation

@bm-w
Copy link

@bm-w bm-w commented Apr 3, 2025

instantiation_expression syntax nodes were not included in the list of basic expressions, and thus the @expr.lexical_scope graph node was not being created for them. This caused an error in the stanza that deals with function arguments, e.g.:

0: Error executing statement edge @arg.lexical_scope -> @args.lexical_scope at (3515, 3)
     src/stack-graphs.tsg:3515:3:
     3515 |   edge @arg.lexical_scope -> @args.lexical_scope
          |   ^
     in stanza
     src/stack-graphs.tsg:3511:1:
     3511 | (arguments (_)@arg)@args {
          | ^
     matching (arguments) node
     test/test.ts:3:4:
     3 | foo(Bar<string>);
       |    ^
1: Evaluating edge source
2: Undefined scoped variable [syntax node instantiation_expression (3, 5)].lexical_scop

Simply including instantiation_expression syntax nodes in the list fixe the issue. Copious testing (on our TS test suite and on all of microsoft/vscode) reveals no negative side effects.

Actually resolving a reference appearing in an instantiation expression as call argument does not work — I left a TODO.

Copilot AI review requested due to automatic review settings April 3, 2025 14:37
@bm-w bm-w requested review from a team as code owners April 3, 2025 14:37
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where instantiation_expression syntax nodes were not included in the list of basic expressions, causing errors when handling function argument lexical scopes.

  • Added a new test file to verify that instantiation expressions are properly handled.
  • The new test confirms that the fix resolves the error when using instantiation expressions as call arguments.
Files not reviewed (1)
  • languages/tree-sitter-stack-graphs-typescript/src/stack-graphs.tsg: Language not supported

@CleanCut
Copy link
Contributor

CleanCut commented Sep 9, 2025

The github/stack-graphs repository is no longer being maintained. As per #502, I'm closing all issues and pull requests before archiving the repository.

@CleanCut CleanCut closed this Sep 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants